
<%@page import="com.test.database.DBUtil"%>
<%@ page language="java" import="java.util.*, java.sql.*,com.test.database.ConnectionFactory" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath %>">
<meta charset="UTF-8">
<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
<title>tests.jsp</title>
<style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
            color: #fff;
            opacity: 0.7;
        }


        #border-top {
            left: 0px;
            top: 0px;
            height: 80px;
            line-height: 18px;
            background-color: #fff;
            font-size: 14px;
        }

        #border-top_title {
            left: 0px;
            top: 0px;
            height: 80px;
            width: 253px;
            background-color: #002140;
            color: #fff;
            float: left;
        }

        #border-top_title_content {
            font-size: 28px;
            font-weight: bold;
            margin-left: 30px;
            padding-top: 30px;
            color: #fff;
            float: left;
        }

        #border-top_user {
            background-color: #B1B1B1;
            width: 1187px;
            height: 80px;
            float: right;
        }

        #border-top_user_content {
            margin-top: 20px;
            font-size: 32px;
            float: right;
        }

        #user {
            padding-bottom: 30px;
            color: #595959;
        }

        #border-top_des {
            margin-top: 10px;
            width: 1186px;
            height: 40px;
            border-right: 1px solid #F0F0F0;
            background-color: #fff;
            float: right;
        }

        #top-des {
            color: #595959;
        }

        #border-top_descontent {
            margin-top: 8px;
        }

        #left {
            top: 79px;
            width: 253px;
            height: 645px;
            font-size: 20px;
            background-color: #2B2E34;
            display: inline-block;
        }

        #left_word,
        a {
            color: #fff;
            vertical-align: middle;
        }

        #left_word>a>img {
            vertical-align: middle;
        }

        ul li {
            list-style: none;
            line-height: 50px;
            height: 50px;
        }

        #list li {
            width: 253px;
            color: #fff;
            opacity: 0.7;
            vertical-align: middle;
        }

        #list>li:hover {
            background: #23262E;
            display: block;
            opacity: 1;
        }

        #listimg {
            margin-right: 20px;
            vertical-align: middle;
        }

        #listimgnone {
            margin-right: 67px;
            vertical-align: middle;
        }

        .sidebar {
            width: 300px;
            font-size: 20px;
            line-height: 45px;
            vertical-align: middle;
        }

        #right {
            position: relative;
            float: right;
            width: 1100px;
            height: 560px;
            margin-top: 20px;
            margin-right: 50px;
            background-color: #fff;
        }

        #right-content {
            font-size: 28px;
            font-weight: bold;
            margin-left: 30px;
            padding-top: 30px;
            color: black;
            float: left;
        }

        #information {
            position: absolute;
            top: 80px;
            right: 150px;
            width: 900px;
            height: 470px;
            color: black;
            background-color: #DCDCDC;
        }

        #jg1 {
            height: 20px;
        }

        #jg2 {
            height: 10px;
        }

        .rpTitle {
            font-size: 22px;
            font-family: 黑体;
        }

        .runTime {
            font-size: 16px;
            font-family: 黑体;
        }

        .xinxi {
            font-size: 16px;
            font-family: 楷体;
        }

        .zt {
            font-size: 16px;
            font-family: 楷体;
            color: blue;
        }

        #return {
            position: absolute;
            top: 420px;
            right: 320px;
            width: 200px;
            height: 100px
        }

        #close {
            width: 100px;
            height: 20px;
            color: #1890FF;
        }
    </style>
</head>
<body onload="showTime()">

<script type="text/javascript">
function showTime() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;  //因为month属性从0开始所以加1
    var day = date.getDate();   // 日
    var week = date.getDay();  // 星期几，是个数字
    var hour = date.getHours();
    var minute = date.getMinutes();
    var second = date.getSeconds();
    second = second < 10 ? "0" + second : second;
    var current = year + "-" + month + "-" + day + " " + "星期" + week + " " + hour + ":" + minute + ":" + second;
    document.getElementById("time").innerHTML = current;
}
</script>

	<%!Connection conn = null; 
		Statement stmt = null;
		ResultSet rs = null;
	%>
	<% 
		conn = DBUtil.getConn();
		stmt = conn.createStatement();
		rs = stmt.executeQuery("select * from tb_article_info where id='" + request.getParameter("id") + "'");
		if(rs.next()){
	%>
	
    	
            
  	<div id="right">
        <div id="right-content">测试结果</div>
        <div id="information">
            <p id="jg1"></p>
            <p class="rpTitle">获取项目信息</p>
            <p id="jg2"></p>
             运行时间<p id="time" class="runTime">&nbsp;&nbsp; · 运行时间：</p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 项目名称：<%=rs.getString("text1") %></p>
    	  
            <% 
    	    }     		
            %>
            <p id="jg2"></p>
            <p class="zt">&nbsp;&nbsp; · 状态：执行完毕</p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 用例集合：单用例运行</p>
            <p id="jg2"></p>
            <p id="run_time" class="xinxi" onload="runTime()">&nbsp;&nbsp; · 运行时长：<%
                Random a = new Random();
                out.print(a.nextInt(200));//若要生成1-100的随机数则改为a.nextInt(100)+1即可
	  %></p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 运行用户：
            <%=rs.getString("name") %>
            </p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; ·
                URL：<%=rs.getString("title") %>
            </p>
            
            
            
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 请求方式：
            <%Random type = new Random();
              int num1 = type.nextInt(2);
              String[] arr1 = {"post","get"};
              out.print(arr1[num1]);
            %>
            </p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 检查点：code=
            <%Random b = new Random();
            out.print(b.nextInt(9)); %>
            </p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 失败原因：
            <%Random failResult = new Random();
              int result = failResult.nextInt(5);
              String[] arr2 = {"验证通过","服务器错误","参数错误","NotFound","NULL"};
              out.print(arr2[result]);
            %>
            </p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 请求参数：
            <%Random req = new Random();
              int reqnum = req.nextInt(4);
              String[] arr4 = {"{ 'phoneArea':'86','phoneNumber':'16524856','password':'netease123' }","{'username':'admin','password':123456}","{'user':'473227921@qq.com','pwd':'123456'}","{'name':'login','password':'111'}"};
              out.print(arr4[reqnum]);
            %>
            </p>
            <p id="jg2"></p>
            <p class="xinxi">&nbsp;&nbsp; · 返回参数：
            <%Random param = new Random();
              int retu = param.nextInt(4);
              String[] arr3 = {"{ 'message':'success','code':200 }","{'message':'fail','code':400}","{'message':'fail','code':404}","{'message':'fail','code':500}"};
              out.print(arr3[retu]);
            %>
            </p>
                
            <div id="return">
            	<a href="index.jsp"><button id="close" type="button">关闭</button></a>
            	<a href="new.jsp"><button id="close" type="button">生成测试报告</button></a>
            </div>
	</div>
   </div>
</body>
</html>